package com.tianji.learning.controller;


import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domain.page.QuestionAdminPageQuery;
import com.tianji.learning.domain.po.InteractionQuestion;
import com.tianji.learning.domain.vo.QuestionAdminVO;
import com.tianji.learning.service.IInteractionQuestionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 管理员端互动问题 前端控制器
 * </p>
 *
 * @author rui
 * @since 2024-07-21
 */
@RestController
@RequestMapping("/admin/questions")
@Api(tags = "管理端互动问题")
@RequiredArgsConstructor
public class InteractionAdminQuestionController {
    private final IInteractionQuestionService questionService;
    @ApiOperation("分页查询问题信息")
    @GetMapping("/page")
    public PageDTO<QuestionAdminVO> pageQuery(QuestionAdminPageQuery pageQuery){
        return questionService.adminPageQuery(pageQuery);
    }
    @ApiOperation("设置是否在用户端隐藏")
    @PutMapping("/{id}/hidden/{hidden}")
    public void updateHiddenById(@PathVariable("id") Long questionId,@PathVariable("hidden") Boolean hidden ){
        questionService.updateHiddenById(questionId,hidden);
    }

    @ApiOperation("根据id查询问题详情")
    @GetMapping("/{id}")
    public QuestionAdminVO adminQueryByQuestionId(@PathVariable("id") Long questionId){
        return questionService.adminQueryByQuestionId(questionId);
    }
}
